import request from '@/utils/request'

// 查询服务回访单列表
export function listRevisit(query) {
  return request({
    url: '/crm/revisit/list',
    method: 'get',
    params: query
  })
}

// 查询服务回访单详细
export function getRevisit(id) {
  return request({
    url: '/crm/revisit/' + id,
    method: 'get'
  })
}

// 新增服务回访单
export function addRevisit(data) {
  return request({
    url: '/crm/revisit',
    method: 'post',
    data: data
  })
}

// 修改服务回访单
export function updateRevisit(data) {
  return request({
    url: '/crm/revisit',
    method: 'put',
    data: data
  })
}

// 删除服务回访单
export function delRevisit(id) {
  return request({
    url: '/crm/revisit/' + id,
    method: 'delete'
  })
}

// 查询详细客户信息
export function getCustomerInfo(customerName) {
  return request({
    url: '/crm/customer/customer/' + customerName,
    method: 'get'
  })
}

// 查询详细的跟进记录
export function getFollowRecord(customerName) {
  return request({
    url: '/crm/record/name/' + customerName,
    method: 'get'
  })
}

// 查询联系人的详细信息
export function getContact(customerName) {
  return request({
    url: '/crm/person/contact/' + customerName,
    method: 'get'
  })
}

// 获取公司首要联系人的详细信息
export function getFirstContactInfoByCustomerName(customerName) {
  return request({
    url: '/crm/person/contact/first/' + customerName,
    method: 'get'
  })
}

// 根据联系人姓名查询联系人的详细信息
export function getContactByTelName(telName) {
  return request({
    url: '/crm/person/contact/telname/' + telName,
    method: 'get'
  })
}

// 根据服务单号获取客户服务单详细信息
export function getInfoByServiceNo(serviceNo) {
  return request({
    url: '/crm/servicecustomer/serviceno/' + serviceNo,
    method: 'get'
  })
}

// 根据客户名称查询某个客户服务单列表
export function getServiceInfoByCustomerName(customerName) {
  return request({
    url: '/crm/servicecustomer/customername/' + customerName,
    method: 'get'
  })
}

// 根据回访单号获取服务回访单详细信息
export function getInfoByRevisitNo(revisitNo) {
  return request({
    url: '/crm/revisit/revisitno/' + revisitNo,
    method: 'get'
  })
}
